from ctypes import *
#define OPENSSLKEY "test.key"
#define PUBLICKEY "test_pub.key"

librsa=CDLL("libopenssl_rsa.so")
cleartext = '11111111111111111111111111111111'
#cleartext = 'oopensslopensslopensslopensslpenssl'
enc = librsa.encrypt
enc.argtype=[c_char_p,c_char_p]
enc.restype=c_char_p

dec = librsa.decrypt
dec.argtype=[c_char_p,c_char_p]
dec.restype=c_char_p

free = librsa.rsafree
free.argtype=c_char_p
free.testype=None
cipher = enc(cleartext.decode("HEX"),'test_pub.key')
clear  = dec(cipher,'test.key')
print "\npycipher:\n%s"%cipher.encode("HEX")
print "\npyclear :\n%s"%clear.encode("HEX")
#free(cipher)
#free(clear)
